﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;

/// <summary>
/// Summary description for Logging
/// </summary>
public class Logging
{

    string m_ErrorMsg;
    string m_FilePath;

    public Logging(string ErrorMsg, string FilePath)
    {

        m_ErrorMsg = ErrorMsg;
        m_FilePath = FilePath;

    }


    public void WriteToLog(bool IsItAnError)
    {
        //FileStream fsOut = File.Create(m_FilePath);
        StreamWriter sw = new StreamWriter(m_FilePath, true);

        if (IsItAnError == true)
        {
            sw.WriteLine("Error: " + sw.NewLine);
        }

        sw.WriteLine(m_ErrorMsg + sw.NewLine);
        sw.WriteLine(DateTime.Now.ToString() + sw.NewLine + sw.NewLine);
        sw.Flush();
        sw.Close();
        //fsOut.Close();


    }
}
